home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10499 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: hex to dec function?
  5. Date: 14 Mar 96 20:32:19 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.826835539@rscernix>
  8. References: <4gdh1b$bg@mailhost.mwmicro.com> <4hl8mk$1er@info.uah.edu> <313EE885.4511@cmt.lpr.mail.carel.fi> <4i87sm$7n0@info.uah.edu>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <4i87sm$7n0@info.uah.edu> gbacon@oreo (Greg Bacon) writes:
  13.  
  14. >Ari Lukumies (aril@cmt.lpr.mail.carel.fi) wrote:
  15. >: Greg Bacon wrote:
  16. >: > 
  17. >: >    (void) printf("%d\n", strtol(strHexVal, (char **) NULL, 10));
  18. >: > [snip]
  19. >
  20. >: Just a quick sidenote: if you use strtol() in a printf call, use the
  21. >: correct format string, also: "%ld\n".
  22. >
  23. >OK, OK.. you got me.  I should have commented that I was assuming int
  24. >and long were of the same length (a trait not often found on the
  25. >braindead iAPX platform :).
  26.  
  27. The assumption is both brain dead and unnecessary.
  28.  
  29. >The above works on most modern Unices.
  30.  
  31. Who cares?  Broken code which happens to "work" on your machine is even 
  32. worse than broken code which doesn't work.
  33.  
  34. BTW, I'm typing this article on a modern Unix system where int and long 
  35. have different sizes.
  36.  
  37. Dan
  38. --
  39. Dan Pop
  40. CERN, CN Division
  41. Email: danpop@mail.cern.ch 
  42. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  43.